package edu.gdut.thesissys.vo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Institute entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "institute", catalog = "gdutmis")
public class Institute extends BaseVo implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -9147510096565210419L;
	// Fields

	private Integer instituteId;
	private String name;
	private Set<Department> departments = new HashSet<Department>(0);

	// Constructors

	/** default constructor */
	public Institute() {
	}

	/** minimal constructor */
	public Institute(String name) {
		this.name = name;
	}

	/** full constructor */
	public Institute(String name, Set<Department> departments) {
		this.name = name;
		this.departments = departments;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "institute_id", unique = true, nullable = false)
	public Integer getInstituteId() {
		return this.instituteId;
	}

	public void setInstituteId(Integer instituteId) {
		this.instituteId = instituteId;
	}

	@Column(name = "name", nullable = false, length = 30)
	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "institute")
	public Set<Department> getDepartments() {
		return this.departments;
	}

	public void setDepartments(Set<Department> departments) {
		this.departments = departments;
	}

}